package com.leo.train.business.mapper;

import com.github.pagehelper.Page;
import com.leo.train.business.dto.CarriageQueryDto;
import com.leo.train.business.entity.Carriage;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
public interface CarriageMapper {

    /**
     * 添加
     * @param carriage
     */
    void insert(Carriage carriage);

    /**
     * 修改
     */
    void update(Carriage carriage);

    /**
     * 删除
     * @param id
     */
    void deleteById(Long id);

    /**
     * 查询
     * @param carriageQueryDto
     * @return
     */
    Page<Carriage> list(CarriageQueryDto carriageQueryDto);

    /**
     * 查询详情
     * @param id
     * @return
     */
    Carriage selectById(Long id);

    /**
     * 根据车次查询所有车厢
     * @param trainCode
     * @return
     */
    List<Carriage> listByTrainCode(String trainCode);

    /**
     * 根据车次和索引查询车厢
     * @param trainCode
     * @param index
     * @return
     */
    Carriage selectByTrainCodeAndIndex(String trainCode, Integer index);
}
